﻿@using OA.Model
@using OA.Model.View
@using OA.Core.Helper;
@{
    ViewBag.Title = "首页";
    Layout = "~/Areas/Member/Views/Shared/_Layout.cshtml";
    List<SimpleNotice> notices = ViewBag.Notices;
    List<CustomForm> customForms = ViewBag.MyCustomForm;
    List<VWaitForHandling> waitForHandling = ViewBag.WaitForHandling;
    List<Approval> launched = ViewBag.Launched;
    List<Mailbox> inbox = ViewBag.Inbox;
    string empID = ViewBag.EmpID;

}
<style type="text/css">
    .layui-card {
        margin-bottom: 0px !important;
    }

    .layui-card-header {
        height: 50px;
        line-height: 50px;
        text-align: left;
    }

    .layui-card {
        float: left;
        width: 100%;
    }

    .layui-col-space1 > * {
        padding: 2px !important;
    }
    .news li a{text-align:left;}
</style>
<div class="layui-row layui-col-space1">
    <div class="layui-col-md6">
        <div class="layui-card">
            <div class="layui-card-header">
                <i class="iconfont iconhuabanfuben"></i>
                <span>通知公告</span>
                <span class="right"><a lay-href="/Member/Notice/Index" lay-text="通知公告">更多</a></span>
            </div>
            <div class="layui-card-body" style="height:137px;">
                <ul class="news">
                    @foreach (SimpleNotice item in notices)
                    {
                        <li><a href="javascript:ShowPage('/Member/Notice/Details/@item.ID','@item.Title')">[@item.Type]@item.Title<span style="display:inline-block;float:right;">@item.SendTime.ToString("yyyy-MM-dd HH:mm")</span></a></li>
                    }
                </ul>
            </div>
        </div>
    </div>
    <div class="layui-col-md6">
        <div class="layui-card">
            <div class="layui-card-header">
                <i class="iconfont iconshenpiliucheng"></i>流程审批
            </div>
            <div class="layui-card-body" style="float:left;width:100%;padding:10px 5px;">
                <div style="height:137px;vertical-align:middle;float:left;width:30px;">
                    <div style="margin-top:42px;width:28px;height:27px;border-radius:50%;background-color:#4c9360;text-align:center;padding-top:3px;padding-right:2px;filter:alpha(Opacity=20);-moz-opacity:0.2;opacity: 0.2;background-color:#000;">
                        <i class="layui-icon layui-icon-left" style="font-size:22px; color:#fff;cursor:pointer;"></i>
                    </div>
                </div>

                <div style="height:137px;vertical-align:middle;float:right;width:31px;margin-right:10px;">
                    <div style="margin-top:42px;width:26px;height:28px;border-radius:50%;padding-top:3px;padding-left:5px;filter:alpha(Opacity=20);-moz-opacity:0.2;opacity: 0.2;background-color:#000;">
                        <i class="layui-icon layui-icon-right" style="font-size:22px; color: #fff;text-align:center;cursor:pointer;"></i>
                    </div>
                </div>

                <div style="position:absolute;top:0px;left:36px;right:52px;height:137px;overflow:hidden;" id="myCustomForms">
                    <ul class="customForms" style="width:2000px;position:absolute;">
                        @foreach (CustomForm item in customForms)
                        {
                            <li style="border-radius:10px;height:120px;width:120px;background-color:#f3f3f3;margin-top:10px;margin-left:10px;float:left;">
                                <a lay-href="/Member/CustomForm/Index?id=@item.ID" data-code="002" class="code code_002" style="padding-top:10px;display:block;width:120px;height:110px;text-align:center;">
                                    <img src="@item.Ico" style="height:75px;" />
                                    <span style="display:block;text-align:center;margin-top:6px;">@item.Name</span>
                                </a>
                            </li>
                        }
                    </ul>
                </div>

                <script type="text/javascript">
                    var _index = 0;
                    var myLength =@customForms.Count-1;
                    var myWwidth = $("#myCustomForms").width();
                    
                    $(".layui-icon-right").click(function(){
                        _index++; 
                        var visibleLi = Math.ceil(myWwidth / 130);
                        var len = $(".customForms li").length;
                        if (_index + visibleLi - 1 > len) {
                           _index--; 
                        }
                        else {
                            $(".customForms").stop().animate({left:-_index*130},500);
                        }
	                    
                    });
                    $(".layui-icon-left").click(function(){
                        if (_index == 0) {

                        }
                        else {
                            _index--;
	                        $(".customForms").stop().animate({left:-_index*130},500);
                        }
	                    
                    });
                </script>

            </div>
        </div>
    </div>
    <div class="layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-header">
                <i class="iconfont icondaiban1"></i>我的待办
                <span class="right"><a lay-href="/Member/UserCenter/WaitForHandling" lay-text="我的待办">更多</a></span>
            </div>
            <div class="layui-card-body">
                <table class="layui-table">
                    <thead>
                        <tr>
                            <td style="width:62px;">编号</td>
                            <td style="width:100px;text-align:center;">类型</td>
                            <td>主题</td>
                            <td style="width:80px;text-align:center;">申请人</td>
                            <td style="width:120px;text-align:center;">申请时间</td>
                            <td style="min-width:72px;text-align:center;">当前处理人</td>
                            <td style="width:120px;text-align:center;">到达时间</td>
                            <td style="width:40px;text-align:center;">操作</td>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (VWaitForHandling info in waitForHandling)
                        {
                            <tr>
                                <td>@info.No</td>
                                <td style="text-align:center;">@info.Name</td>
                                <td>
                                    @if (info.EmpName != empID)
                                    {
                                        <span class="layui-badge-dot"></span><span style="padding-left:4px;" title="委托单据">@info.Title</span>
                                    }
                                    else
                                    {
                                        <span class="layui-badge-dot layui-bg-orange"></span><span style="padding-left:4px;">@info.Title</span>
                                    }

                                </td>
                                <td style="text-align:center;">@info.EmpName</td>
                                <td style="text-align:center;">@info.CreateDateTime.ToString("yyyy-MM-dd HH:mm")</td>
                                <td style="text-align:center;">@info.Suspense</td>
                                <td style="text-align:center;">@info.CreateDateTime.ToString("yyyy-MM-dd HH:mm")</td>
                                <td>
                                    <a class="layui-btn layui-btn-xs" lay-href="/Member/Home/Conduct/@info.ID">审批</a>
                                </td>
                            </tr>

                        }
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-header">
                <i class="iconfont iconzhubanquan"></i>我的主办
                <span class="right"><a lay-href="/Member/UserCenter/Launched" lay-text="我的主办">更多</a></span>
            </div>
            <div class="layui-card-body">
                <table class="layui-table">
                    <thead>
                        <tr>
                            <td style="width:62px;">编号</td>
                            <td>主题</td>
                            <td style="width: 120px; text-align: center;">申请时间</td>
                            <td style="width:80px;text-align:center;">状态</td>
                            <td style="min-width:78px;text-align:center;">当前审批人</td>
                            <td style="min-width:78px;text-align:center;">需沟通成员</td>
                            <td style="width: 120px; text-align: center;">完成时间</td>
                            <td style="width:40px;text-align:center;">操作</td>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (Approval info in launched)
                        {
                            <tr>
                                <td>@info.No</td>
                                <td>@info.Title</td>
                                <td style="text-align:center;">@info.CreateDateTime.ToString("yyyy-MM-dd HH:mm")</td>
                                <td style="text-align:center;">@info.StatusName</td>
                                <td style="text-align:center;">@info.Suspense</td>
                                <td style="text-align:center;">@info.NeedExplainEmpID</td>
                                <td style="text-align:center;">@info.FinishTime.ToString2()</td>
                                <td style="text-align:center;">
                                    <a class="layui-btn layui-btn-xs" lay-href="/Member/CustomForm/Show?formID=@info.FormID&customID=@info.CustomID">查看</a>                                    
                                </td>
                            </tr>

                        }
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <div class="layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-header">
                <i class="iconfont iconshoujianxiang2"></i>我的收件箱
                <span class="right"><a lay-href="/Member/Mailbox/Inbox" lay-text="我的收件箱">更多</a></span>
            </div>
            <div class="layui-card-body">
                <table class="layui-table">
                    <thead>
                        <tr>
                            <td>标题</td>
                            <td>发送人</td>
                            <td style="width:130px;text-align:center;">发送时间</td>
                            <td style="text-align:center;">状态</td>
                            <td style="width:40px;text-align:center;">操作</td>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (Mailbox info in inbox)
                        {
                            <tr>
                                <td>@info.Title</td>
                                <td>@info.FromDepartmentName @info.FromPositionName @info.FromEmpName</td>
                                <td style="text-align:center;">@info.CreateDateTime.ToString("yyyy-MM-dd HH:mm")</td>
                                <td style="text-align:center;">@info.StatusName</td>
                                <td style="text-align:center;">
                                    <a class="layui-btn layui-btn-xs" lay-href="/Member/Mailbox/Index/@info.ID?type=inbox">查看</a>
                                </td>
                            </tr>

                        }
                    </tbody>
                </table>
            </div>
        </div>
    </div>


</div>
